package org.pih.javarosa.applogic;

import org.javarosa.core.api.State;
import org.javarosa.services.properties.api.PropertyUpdateState;
import org.javarosa.user.api.AddUserState;
import org.javarosa.user.model.User;
import org.pih.javarosa.activity.formList.AdultDosageFormListController;
import org.pih.javarosa.activity.formList.FormListTransitions;

public class AdultDosageFormListState implements FormListTransitions, State {

	public void start() {
		AdultDosageFormListController ctrl = new AdultDosageFormListController();
		ctrl.setTransitions(this);
		ctrl.start();	
	}

	public void formSelected(int formID) {
		new AdultDosageFormEntryState(formID).start();
	}

	public void viewSaved() {
		new AdultDosageSavedFormListState().start();
	}

	public void back() {
		new AdultDosagePatientSelectState().start();
	}
	
	public void settings() {
		new PropertyUpdateState () {
			public void done () {
				new AdultDosageFormListState().start();
			}
		}.start();
	}

	public void addUser() {
		new AddUserState () {
			public void cancel() {
				new AdultDosageFormListState().start();
			}

			public void userAdded(User newUser) {
				new AdultDosageFormListState().start();
			}
		}.start();
	}
}
